package cn.edu.hqu.cst.crj.recycledemo;

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget. LinearLayoutManager;

import android.os.Bundle;

import java.util.ArrayList;
import java.util.List;

public class MainActivity extends AppCompatActivity {
    private RecyclerView recyclerView;
    private RecyclerAdapter recyclerAdapter;

    private List<Huoying> huoyingList;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initData();
        initView();
        setListener();
    }

    private void initData() {
        huoyingList = new ArrayList<>(28);
        huoyingList.add(new Huoying(1, "千手柱间", "木遁"));
        huoyingList.add(new Huoying(2, "千手扉间", "水遁"));
        huoyingList.add(new Huoying(3, "猿飞日斩", "猿魔"));
        huoyingList.add(new Huoying(4, "波风水门", "飞雷神"));
        huoyingList.add(new Huoying(5, "千手纲手", "百豪之术"));
        huoyingList.add(new Huoying(6, "旗木卡卡西", "雷切"));
        huoyingList.add(new Huoying(7, "漩涡鸣人", "螺旋丸"));
        huoyingList.add(new Huoying(8, "千手柱间", "木遁"));
        huoyingList.add(new Huoying(9, "千手扉间", "水遁"));
        huoyingList.add(new Huoying(10, "猿飞日斩", "猿魔"));
        huoyingList.add(new Huoying(11, "波风水门", "飞雷神"));
        huoyingList.add(new Huoying(12, "千手纲手", "百豪之术"));
        huoyingList.add(new Huoying(13, "旗木卡卡西", "雷切"));
        huoyingList.add(new Huoying(14, "漩涡鸣人", "螺旋丸"));
        huoyingList.add(new Huoying(15, "千手柱间", "木遁"));
        huoyingList.add(new Huoying(16, "千手扉间", "水遁"));
        huoyingList.add(new Huoying(17, "猿飞日斩", "猿魔"));
        huoyingList.add(new Huoying(18, "波风水门", "飞雷神"));
        huoyingList.add(new Huoying(19, "千手纲手", "百豪之术"));
        huoyingList.add(new Huoying(20, "旗木卡卡西", "雷切"));
        huoyingList.add(new Huoying(21, "漩涡鸣人", "螺旋丸"));
        huoyingList.add(new Huoying(22, "千手柱间", "木遁"));
        huoyingList.add(new Huoying(23, "千手扉间", "水遁"));
        huoyingList.add(new Huoying(24, "猿飞日斩", "猿魔"));
        huoyingList.add(new Huoying(25, "波风水门", "飞雷神"));
        huoyingList.add(new Huoying(26, "千手纲手", "百豪之术"));
        huoyingList.add(new Huoying(27, "旗木卡卡西", "雷切"));
        huoyingList.add(new Huoying(28, "漩涡鸣人", "螺旋丸"));
    }


    private void initView()
    {
        recyclerView = findViewById(R.id.rv_successive_dynasties_huoying);
        // 线性布局管理器
        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
        recyclerView.setLayoutManager(linearLayoutManager);
        // 用于描述item的适配器
        recyclerAdapter = new RecyclerAdapter(huoyingList);
        recyclerView.setAdapter(recyclerAdapter);
    }

    private void setListener() {

    }
}
